/**
 * All rights Reserved, Copyright (C) HAOWU LIMITED 2011-2014
 * FileName: CustomViewPager.java
 * Version:  $Revision$
 * Modify record:
 * NO. |		Date		|		Name		|		Content
 * 1   |	2014年12月8日		|	HAOWU)RenJie|	original version
 */

package com.zx.kitchen.index.common.view.viewpager;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * class name:CustomViewPager <BR>
 * class description: please write your description <BR>
 * Remark: <BR>
 * 
 * @version 1.00 2014年12月8日
 * @author HAOWU)RenJie
 */
public class CustomViewPagerInMain extends ViewPager {

    public static boolean isCanScroll = true;

    public CustomViewPagerInMain(Context context) {
        super(context);
    }

    public static boolean isCanScroll() {
        return isCanScroll;
    }

    public static void setCanScroll(boolean IsCanScroll) {
        isCanScroll = IsCanScroll;
    }

    public CustomViewPagerInMain(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (isCanScroll == false) {
            return false;
        } else {
            try {
                return super.onInterceptTouchEvent(ev);
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
                return false;
            }
        }
    }
}
